package com.guguskins.back.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author mybatis-plus
 * @since 2021-06-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("gu_roll")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class GuRoll extends Model<GuRoll> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "roll_id", type = IdType.AUTO)
    private Long rollId;

    /**
     * 房主id
     */
    private Long rollUserId;

    /**
     * 房主steamId
     */
    private String rollSteamId;

    /**
     * 标题
     */
    private String rollTitle;

    /**
     * 背景图片
     */
    private String rollImage;

    /**
     * 描述
     */
    private String rollDesc;

    /**
     * 开奖时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime rollLotteryTime;

    /**
     * 密码
     */
    private String rollPassword;

    /**
     * 人数限制
     */
    private Integer rollNumberLimit;

    /**
     * 等级限制 0 无限制
     */
    private Integer rollLevelLimit;

    /**
     * 天数限制 0 无限制
     */
    private Integer rollDateLimit;

    /**
     * 充值限制 0 无限制
     */
    private BigDecimal rollAmountLimit;

    /**
     * 状态（0 无效 1 有效 2 已开奖）
     */
    private Integer rollState;

    /**
     * 越小越靠前
     */
    private Integer rollSort;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime rollCreateTime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime rollUpdateTime;

    @TableField(exist = false)
    private String userNickname;

    @TableField(exist = false)
    private String userImage;

    @TableField(exist = false)
    private String userType;

    @TableField(exist = false)
    private Long goodsNum;

    @TableField(exist = false)
    private List<GuGoods> goodsList;

    @TableField(exist = false)
    private List<GuGoods> simpleGoodsList;

    @TableField(exist = false)
    private Long userNum;

    @TableField(exist = false)
    private List<GuUser> users;

    @TableField(exist = false)
    private BigDecimal totalPrice;

    @TableField(exist = false)
    private List<Long> inventoryIds;


    @Override
    protected Serializable pkVal() {
        return this.rollId;
    }

}
